﻿@model IEnumerable<SDSystem.Models.Programme>
@using Ext.Net.MVC;
@using Ext.Net;
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@section ToolbarSection
{
@Html.X().ToolbarTextItem().Text("<h3 style=\"color:darkgreen\">Programme List</h3>")
}
@* GridPanel *@
@(Html.X().GridPanel().ID("DataGridPanel")
        .Frame(true)
        .Store(Html.X().Store().ID("ProgrammeStore")
                .Model(Html.X().Model().IDProperty("ContactId")
                .Fields(
                    new ModelField("ProgrammeId", ModelFieldType.Int),
                    new ModelField("ProgrammeName"),
                    new ModelField("Description"),
                    new ModelField("SureName"),
                    new ModelField("IsActive")
                )
            )
            .RemoteSort(true)
            .RemotePaging(true)
            .RemoteFilter(true)
            .PageSize(10)
            .Proxy(
                        Html.X().AjaxProxy()
                            .Url(Url.Action("BindingStore"))
                            .Reader(Html.X().JsonReader().Root("data"))
                    )


        )
        .ColumnModel(
                    Html.X().Column().Text("ID").DataIndex("ProgrammeId"),
                    Html.X().TemplateColumn().Text("Programme Name").TemplateString("<a href='javascript:void(0)' onclick='showWindow(\"Edit Programme\",\"/Programme/Edit/{ProgrammeId}\", true, 0.85, 0.85);'>{ProgrammeName}</a>").Flex(1),
                    Html.X().Column().Text("Description").DataIndex("Description").Flex(2),
                    Html.X().Column().Text("Contact").DataIndex("SureName").Flex(1),
                    Html.X().Column().Text("Is Active?").DataIndex("IsActive").Flex(1),
                    Html.X().CommandColumn().Text("Active").Width(50).Commands(
                    Html.X().GridCommand().CommandName("Active").Icon(Icon.Accept).ToolTip(tt => tt.Text = "Active"))
                            .Listeners(ls => ls.Command.Handler = "#{DirectMethods}.ActiveProgramme(record.data.ProgrammeId);")

        )
        .TopBar(
            Html.X().Toolbar().Items(items =>
            {

                items.Add(new LinkButton { Text = "All", Handler = "#{DirectMethods}.CharFilter1('');", });

                items.Add(new ToolbarSpacer());
                items.Add(new ToolbarSeparator());
                items.Add(new ToolbarSpacer());

                items.Add(new LinkButton { Text = "0-9", Handler = "#{DirectMethods}.CharFilter1('0');", });

                items.Add(new ToolbarSpacer());
                items.Add(new ToolbarSeparator());
                items.Add(new ToolbarSpacer());

                items.Add(new LinkButton { Text = "A", Handler = "#{DirectMethods}.CharFilter1('A');", });
                items.Add(new ToolbarSpacer());
                items.Add(new LinkButton { Text = "B", Handler = "#{DirectMethods}.CharFilter1('B');", });
                items.Add(new ToolbarSpacer());
                items.Add(new LinkButton { Text = "C", Handler = "#{DirectMethods}.CharFilter1('C');", });
                items.Add(new ToolbarSpacer());
                items.Add(new LinkButton { Text = "D", Handler = "#{DirectMethods}.CharFilter1('D');", });
                items.Add(new ToolbarSpacer());
                items.Add(new LinkButton { Text = "E", Handler = "#{DirectMethods}.CharFilter1('E');", });
                items.Add(new ToolbarSpacer());

                items.Add(new ToolbarSpacer());
                items.Add(new ToolbarSeparator());
                items.Add(new ToolbarSpacer());

                items.Add(new LinkButton { Text = "F", Handler = "#{DirectMethods}.CharFilter1('F');", });
                items.Add(new ToolbarSpacer());
                items.Add(new LinkButton { Text = "G", Handler = "#{DirectMethods}.CharFilter1('G');", });
                items.Add(new ToolbarSpacer());
                items.Add(new LinkButton { Text = "H", Handler = "#{DirectMethods}.CharFilter1('H');", });
                items.Add(new ToolbarSpacer());
                items.Add(new LinkButton { Text = "I", Handler = "#{DirectMethods}.CharFilter1('I');", });
                items.Add(new ToolbarSpacer());
                items.Add(new LinkButton { Text = "J", Handler = "#{DirectMethods}.CharFilter1('J');", });
                items.Add(new ToolbarSpacer());

                items.Add(new ToolbarSpacer());
                items.Add(new ToolbarSeparator());
                items.Add(new ToolbarSpacer());

                items.Add(new LinkButton { Text = "K", Handler = "#{DirectMethods}.CharFilter1('K');", });
                items.Add(new ToolbarSpacer());
                items.Add(new LinkButton { Text = "L", Handler = "#{DirectMethods}.CharFilter1('L');", });
                items.Add(new ToolbarSpacer());
                items.Add(new LinkButton { Text = "M", Handler = "#{DirectMethods}.CharFilter1('M');", });
                items.Add(new ToolbarSpacer());
                items.Add(new LinkButton { Text = "N", Handler = "#{DirectMethods}.CharFilter1('N');", });
                items.Add(new ToolbarSpacer());

                items.Add(new ToolbarSpacer());
                items.Add(new ToolbarSeparator());
                items.Add(new ToolbarSpacer());

                items.Add(new LinkButton { Text = "O", Handler = "#{DirectMethods}.CharFilter1('O');", });
                items.Add(new ToolbarSpacer());
                items.Add(new LinkButton { Text = "P", Handler = "#{DirectMethods}.CharFilter1('P');", });
                items.Add(new ToolbarSpacer());
                items.Add(new LinkButton { Text = "Q", Handler = "#{DirectMethods}.CharFilter1('Q');", });
                items.Add(new ToolbarSpacer());
                items.Add(new LinkButton { Text = "R", Handler = "#{DirectMethods}.CharFilter1('R');", });
                items.Add(new ToolbarSpacer());

                items.Add(new ToolbarSpacer());
                items.Add(new ToolbarSeparator());
                items.Add(new ToolbarSpacer());

                items.Add(new LinkButton { Text = "S", Handler = "#{DirectMethods}.CharFilter1('S');", });
                items.Add(new ToolbarSpacer());
                items.Add(new LinkButton { Text = "T", Handler = "#{DirectMethods}.CharFilter1('T');", });
                items.Add(new ToolbarSpacer());
                items.Add(new LinkButton { Text = "U", Handler = "#{DirectMethods}.CharFilter1('U');", });
                items.Add(new ToolbarSpacer());
                items.Add(new LinkButton { Text = "V", Handler = "#{DirectMethods}.CharFilter1('V');", });
                items.Add(new ToolbarSpacer());

                items.Add(new ToolbarSpacer());
                items.Add(new ToolbarSeparator());
                items.Add(new ToolbarSpacer());

                items.Add(new LinkButton { Text = "W", Handler = "#{DirectMethods}.CharFilter1('W');", });
                items.Add(new ToolbarSpacer());
                items.Add(new LinkButton { Text = "X", Handler = "#{DirectMethods}.CharFilter1('X');", });
                items.Add(new ToolbarSpacer());
                items.Add(new LinkButton { Text = "Y", Handler = "#{DirectMethods}.CharFilter1('Y');", });
                items.Add(new ToolbarSpacer());
                items.Add(new LinkButton { Text = "Z", Handler = "#{DirectMethods}.CharFilter1('Z');", });
                items.Add(new ToolbarSpacer());

                items.Add(new ToolbarFill());


                items.Add(new Button
                {
                    Text = "<b>Create</b>",
                    Margins = "0 20 0 0",
                    Icon = Icon.Add,
                    OnClientClick = "showWindow('Create Programme','/Programme/Create',true,0.85,0.85);"

                });


                items.Add(new Checkbox
                {
                    FieldLabel = "<b>Include In-Active</b>",
                    Margins = "0 20 0 0",
                    LabelWidth = 120,
                    LabelAlign = LabelAlign.Right,
                    DirectCheckAction = "IncludeInActive"
                });

            })
        )
        .BottomBar(Html.X().PagingToolbar())
)